﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Shapes;
using System.Drawing;
using Silvermoon.Images;

namespace Silvermoon.Controls.Toolbars
{
    /// <summary>
    /// Button for the toolbar to open/close the menu.
    /// </summary>
    public class ToolbarMenuButton : ContentButton
    {
        public ToolbarMenuButton()
            : base()
        {
            Content = SysImages.OverflowDots;
            Size = new Size(80, 80);
            ControlFlags &= ~ControlFlags.CanFocus;
            StyleName = "ToolbarMenuButton";
        }

        public override bool CanFocus
        {
            get { return false; }
        }


        protected Toolbar Toolbar
        {
            get { return Parent as Toolbar; }
        }

        protected override Shape CreateDefaultBackground()
        {
            return null;
        }

        protected internal override void OnTap(TapEventArgs e)
        {
            Toolbar toolbar = Toolbar;
            if (toolbar != null)
            {
                e.Handled = true;
                toolbar.IsExpanded ^= true;
                e.Cancel = true;
            }
        }
    }
}
